package com.sos.data.enum
{
	import com.sos.utils.ClassUtils;

	public class EnumMetadata
	{
		
		// -------------------------------------------------------------------------------
		// FIELDS
		// -------------------------------------------------------------------------------
		
		private var _items:Vector.<Enum>;
		
		
		public function EnumMetadata(items:Array)
		{
			// Init
			_items = new Vector.<Enum>();
			// Register enum items
			for (var i:int=0; i<items.length; i++) register(items[i] as Enum);
		}
		
		public function get items():Vector.<Enum>
		{
			return _items;
		}
		
		/**
		 * Registers an item into the enumerator metadata
		 * @param enum Enum item to register
		 */		
		public function register(enum:Enum):void
		{
			if (_items.indexOf(enum) > -1) throw new Error("Item " + enum.toString() + " already registered into " + ClassUtils.getPath(enum) + " enum");
			_items.push(enum);
		}



		
	}
}